<template>
  <h1>我是app组件</h1>
  <h1>姓名{{name}}</h1>
  <h1>年龄{{age}}</h1>
  <button @click="sayHello">说话</button>
</template>

<script>
//向下兼容vue2的写法(不建议)
export default {
  name: 'App',
  setup() {
    let name = '张三'
    let age = 18

    function sayHello() {
      alert('我叫' + name + '我' + age + '岁了，你好啊')
    }

    return {
      name,
      age,
      sayHello
    }
  }
}
</script>

<style>

</style>
